#pragma strict

public var allowedTime:int = 0;
private var currentTime = allowedTime;
var targetGuiText : GUIText; 
function Awake()
{
    UpdateTimerText();
 
    // start the timer ticking
    TimerTick();
}
function UpdateTimerText()
{
    // update the textfield
     
    targetGuiText.text = ((currentTime/60)+21).ToString()+" : "+ (currentTime%60).ToString();
}
function TimerTick()
{
    // while there are seconds left
    while(currentTime < 540)
    {
        // wait for 1 second
        yield WaitForSeconds(1);
 
        // reduce the time
        currentTime++;
 
        UpdateTimerText();
    }
 
    // game over
 
}